/**
 * 
 */
package com.wubo.sec.util;

import java.util.Date;

import com.wubo.common.date.DateUtil;
import com.wubo.sec.config.LangUtil;


/**
 * @author wubo
 * @CreateDate 2010-8-9
 * @version 1.0.01
 */
public class DateHelper {
	
	public static String getDayToString(Date date){
		if(date == null){
			return "-";
		}
		Date currentDate = new Date(System.currentTimeMillis());
		long time = currentDate.getTime() - date.getTime();
		if(time < 1){
			return DateUtil.DateToYMDHM(date);
		}
		long t = time / 1000;
		if(t < 60 ){
			return t + LangUtil.get("DateConvertToSeconds");
		}
		if(t < 60 * 60){
			return t/60 + LangUtil.get("DateConvertToMinutes");
		}
		if(t < 60*60*24){
			return t/(60*60) + LangUtil.get("DateConvertToHours");
		}
		if(t < 60*60*24*30){
			return t/(60*60*24) + LangUtil.get("DateConvertToDays");
		}
		if(t < 60*60*24*30*12){
			return t/(60*60*24*30) + LangUtil.get("DateConvertToMonths");
		}
		return DateUtil.DateToYMDHM(date);
	}

}
